import { createRouter, createWebHistory } from "vue-router";

const routes = [
  {
    path: "/",
    name: "home",
    component: () => import("@/Pages/home.vue"),
  },
  {
    path: "/:id",
    name: "readingpage",
    component: () => import("@/Pages/read.vue"),
  },
  {
    path: "/rank",
    name: "rank",
    component: () => import("@/Pages/rank.vue"),
  },
  {
    path: "/update",
    name: "update",
    component: () => import("@/Pages/update.vue"),
  },
  {
    path: "/classify",
    name: "classify",
    component: () => import("@/Pages/classify.vue"),
  },
  {
    path: "/search",
    name: "search",
    component: () => import("@/Pages/search.vue"),
  },
  {
    path: "/detail",
    name: "detail",
    component: () => import("@/Pages/detail.vue"),
  },
  {
    path: "/account-center",
    name: "account-center",
    redirect: "account-center/account-info",
    component: () => import("@/Pages/account-center.vue"),
    children: [
      {
        path: "account-info",
        component: () => import("@/Pages/account-center/account-info.vue"),
      },
      {
        path: "balance",
        component: () => import("@/Pages/account-center/balance.vue"),
      },
      {
        path: "history",
        component: () => import("@/Pages/account-center/history.vue"),
      },
      {
        path: "my-favourite",
        component: () => import("@/Pages/account-center/my-favourite.vue"),
      },
      {
        path: "works",
        component: () => import("@/Pages/account-center/works.vue"),
      },
    ],
  },
];

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes,
});

export default router;
